Repository navigation
feat(model): add HY4-A49B (hy_v4) model support - #897
Merged
Merged
Conversation
Add full BatchGen model package for tencent/Hy4 (hy_v4_vl text backbone: 78 layers, 256 routed experts top-8 + 1 shared expert, MLA with DSA sparse indexer, learnable sinks, output gate, 4-channel iHC carrier, clamped SwiGLU, fp32 lm_head, vendored tokenizer and Jinja template with md5 load gates, manifest-driven conversion and publication, eager/paged KV wrappers, and comprehensive unit tests).
Add HY4 serving attention, FP8 DSA indexer, Triton iHC kernels, fused router/RoPE/sink-gate ops, DP x TP x EP whole-model decode CUDA graphs with direct PyNccl collectives and FA3 auto-split for small buckets, and migrate wrapper phase-state reads to ModelPhaseState.
Fork TP-sharded shared-expert GEMMs onto a side CUDA stream synchronized via events inside captured HY4 decode graphs so they overlap with the inter-node EP all_gather.
Share dynamic per-(token, head) FP8 Q quantization with folded head gates across packed prefill, eager fast decode, and CUDA-graph decode, enforce num_valid_tokens inplace contract in iHC post, and update tokenizer routing tests.
Add the nine required model lifecycle hooks to HyV4ParallelStrategyManager so integrated startup passes verify_manager_model_hooks, and register it in test_model_hooks_contract.py.
Satisfy pr-lint-gate F401/F841 checks on serving_attn.py and test_hy_v4_tp8_resident_ep_layout.py.
5 of 10 tasks
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add end-to-end BatchGen model support for
tencent/Hy4(hy_v4_vltext backbone):config.py) with fail-loud HF resolution and validation for the 78-layer MLA + DSA sparse indexer, 256 routed experts (top-8) + 1 shared expert, 4-channel iHC carrier (hc_mult=4), gated MLA output, learnable sinks, clamped SwiGLU (limit=10), and fp32lm_head.tokenizer.py) with vendored upstream assets, md5 provenance verification, pinned added-token gates, Jinja chat-template rendering, and non-special<think:opensource>/<tool_call:opensource>output parsing.weight_map.py), eager weight loader (weights.py), manifest-driven served-only conversion and publication (hy_v4_publication.py,convert_checkpoint.py), parameter server (hy_v4_parameter_server.py), initializer (hy_v4_initializer.py), parallel strategy manager (Parallel_Strategy_Manager.py, including all Phase E2-a model lifecycle hooks), and native phase assembly (hy_v4_native.py).serving_attn.py), unified dynamic per-head FP8 indexer Q quantization with folded head gates (serving_indexer.py), whole-model decode CUDA graphs with hybrid EP collectives and side-stream shared-expert overlap (decode_cuda_graph.py), Triton fused ops and vendored iHC kernels (fused_ops.py,vendor/vllm_0_35/nvidia/triton_ihc.py), TP sharding and MoE resharding (tp_weight_sharding.py,moe_tp_reshard.py), and wrappers readingModelPhaseState(wrappers.py).batchgen/get_initializer.pyandbatchgen/get_parallel_strategy_manager.py(exact-name dispatch only), plus full unit test coverage undertests/unit/models/hy_v4/andtests/unit/test_model_hooks_contract.py.Motivation
Enables serving
tencent/Hy4in BatchGen within themodelchange-type allowlist (PR_MERGE_POLICY.md§2.5–§2.6). Core runtime prerequisites landed in #884 and kernel primitives landed in #894.Milestone (optional)
HY4 A49B Model Support
Type of Change
model— add/extend model support (models/**+ registration seam + model kernels only)kernel— add/optimize a compute kernel (batchgen_kernels/**+ in-tree kernel dirs)core— change scheduling/serving/runtime scaffolding (the only type that may)fix— narrow bug fix (+ a regression test)infra— build / CI / packaging / scripts / Dockerdocs— documentation onlyFile changes
batchgen/get_initializer.pytencent/hy4,tencent/hy4-fp8,hy4-a49binitializer dispatchbatchgen/get_parallel_strategy_manager.pytencent/hy4,tencent/hy4-fp8,hy4-a49bstrategy manager dispatchbatchgen/models/hy/__init__.pybatchgen/models/hy/hy_v4/__init__.pyhy_v4package exportsbatchgen/models/hy/hy_v4/Parallel_Strategy_Manager.pybatchgen/models/hy/hy_v4/assets/UPSTREAM_SOURCE.jsonbatchgen/models/hy/hy_v4/assets/chat_template.jinjabatchgen/models/hy/hy_v4/assets/generation_config.jsonbatchgen/models/hy/hy_v4/assets/tokenizer.jsonbatchgen/models/hy/hy_v4/assets/tokenizer_config.jsonbatchgen/models/hy/hy_v4/config.pyHyV4Configand checkpoint config loaderbatchgen/models/hy/hy_v4/convert_checkpoint.pybatchgen/models/hy/hy_v4/decode_cuda_graph.pybatchgen/models/hy/hy_v4/fused_ops.pybatchgen/models/hy/hy_v4/hy_v4_initializer.pybatchgen/models/hy/hy_v4/hy_v4_native.pybatchgen/models/hy/hy_v4/hy_v4_parameter_server.pybatchgen/models/hy/hy_v4/hy_v4_publication.pybatchgen/models/hy/hy_v4/model.pyHyV4ForCausalLM, MLA with sink/gate, iHC carrier, MoE, and DSA indexerbatchgen/models/hy/hy_v4/moe_tp_reshard.pybatchgen/models/hy/hy_v4/serving_attn.pybatchgen/models/hy/hy_v4/serving_indexer.pybatchgen/models/hy/hy_v4/tokenizer.pyHyV4Tokenizerwith md5/pinned-token gates and think/tool parsersbatchgen/models/hy/hy_v4/tp_weight_sharding.pybatchgen/models/hy/hy_v4/vendor/__init__.pybatchgen/models/hy/hy_v4/vendor/vllm_0_35/__init__.pybatchgen/models/hy/hy_v4/vendor/vllm_0_35/nvidia/__init__.pybatchgen/models/hy/hy_v4/vendor/vllm_0_35/nvidia/triton_ihc.pybatchgen/models/hy/hy_v4/weight_map.pybatchgen/models/hy/hy_v4/weights.pybatchgen/models/hy/hy_v4/wrappers.pytests/unit/models/hy_v4/__init__.pytests/unit/models/hy_v4/conftest.pytests/unit/models/hy_v4/fixtures/indexer/gen_indexer_oracle.pytests/unit/models/hy_v4/fixtures/indexer/vectors.jsontests/unit/models/hy_v4/fixtures/indexer/verify_indexer_transformers.pytests/unit/models/hy_v4/hf_config_tencent_hy4.jsontests/unit/models/hy_v4/test_hy_v4_attn_seam.pytests/unit/models/hy_v4/test_hy_v4_config.pytests/unit/models/hy_v4/test_hy_v4_convert_checkpoint.pytests/unit/models/hy_v4/test_hy_v4_decode_cuda_graph.pytests/unit/models/hy_v4/test_hy_v4_fp32_ops.pytests/unit/models/hy_v4/test_hy_v4_host_construction.pytests/unit/models/hy_v4/test_hy_v4_indexer_scores.pytests/unit/models/hy_v4/test_hy_v4_native_publication.pytests/unit/models/hy_v4/test_hy_v4_paged_kv.pytests/unit/models/hy_v4/test_hy_v4_parameter_server.pytests/unit/models/hy_v4/test_hy_v4_phase_assembly.pytests/unit/models/hy_v4/test_hy_v4_serving_moe.pytests/unit/models/hy_v4/test_hy_v4_skeleton_under_server_init.pytests/unit/models/hy_v4/test_hy_v4_tokenizer.pytests/unit/models/hy_v4/test_hy_v4_tp8_resident_ep_layout.pytests/unit/models/hy_v4/test_hy_v4_tp_and_absorbed_math.pytests/unit/models/hy_v4/test_hy_v4_wrappers.pytests/unit/test_model_hooks_contract.pyHyV4ParallelStrategyManagerin model lifecycle hook contract testChecklist
README.mdchanged, I ranpython3 scripts/check_readme_update.py --base-ref origin/mainand preserved all News history.